jQuery(document).ready(function(){
	
	$j("#gathering").fadeIn("fast");
	
	$j("#updatemessage").text ( "Please wait... We are searching for new packages and if we find any we will install them automaticly!" );
	

	$j.ajax({
		type: "GET",
		url:  domains+"packages/install/attempts",
		dataType: "json",
		error: function(){
				$j("#gathering").addClass("gathering-error");
				$j("#updatemessage").text( "Ups... Some error with the script... Please contact community :/" );
				$j("#update_indicator").fadeOut("fast");
		},
		success: function ( data, status ){
			
			if ( data.status == "false" )
			{
				$j("#messagegg_box").addClass("gathering-error");
				$j("#updatemessage").text( data.message );
				$j("#update_indicator").fadeOut("fast");

			}
			else if ( data.status == "true" )
			{
				$j("#messagegg_box").removeClass("gathering-error");
				$j("#updatemessage").text( data.message );
				$j("#installationresultlist").append(data.content);
				$j("#gathering").fadeOut("slow");
			}
			
		}
	});

	
	$j("#close1").bind("click", function(){
		$j("#body").css({
			overflow: "auto"	
		});
		$j("#modifyplugin").fadeOut();	
	});
	
	$j("#noticemp_not").bind("click", function(){
		$j("#body").css({
			overflow: "auto"	
		});
		$j("#modifyplugin").fadeOut();		
	});
	
	$j("#modifyplug_handler").bind("click", function(){
	
		$j("#modifyplugin").fadeIn("fast");	
			
	});
	
	$j("#closead").bind("click", function(){
		$j("#body").css({
			overflow: "auto"	
		});
		$j("#adplugin").fadeOut();	
	});
	
	$j("#noticead_not").bind("click", function(){
		$j("#body").css({
			overflow: "auto"	
		});
		$j("#adplugin").fadeOut();		
	});
	
	$j("#adplugins_handler").bind("click", function(){
	
		$j("#adplugin").fadeIn("fast");	
			
	});
	
});